package com.mccken.springframework.factory.support;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.mccken.springframework.factory.config.SingletonBeanRegistry;

/**
 * @program: mccken-collect
 * @description:
 * @author: mccken
 * @create: 2022-11-19 22:58
 **/
public class DefaultSingletonBeanRegistry implements SingletonBeanRegistry {
	private Map<String, Object> singletonObjects = new ConcurrentHashMap<>();

	@Override
	public Object getSingleton(String beanName) {
		return singletonObjects.get(beanName);
	}

	@Override
	public void registerSingleton(String beanName, Object singletonObject) {
		singletonObjects.put(beanName, singletonObject);
	}
}
